//
//  MeCharactor.swift
//  mng
//
//  Created by WTFKL on 2018/4/2.
//  Copyright © 2018年 WTF. All rights reserved.
//

import UIKit
import SpriteKit
class MeCharactor: SKSpriteNode {
    public var isAlive = true;
    public var jumpHeight = 25;
    public var isGetKey = false;
    convenience init(mName:String,mSize:CGSize) {
        self.init();
        self.name = mName;
        self.size = mSize;
        self.anchorPoint = CGPoint(x: 0.5, y: 0);
        self.texture = SKTexture(image: #imageLiteral(resourceName: "charactor"));
        self.physicsBody?.isDynamic = true;
        self.physicsBody = SKPhysicsBody(rectangleOf: mSize, center: CGPoint(x: 0, y: mSize.height/2));
        self.physicsBody?.affectedByGravity = true;
        self.zRotation = 0;
        self.physicsBody?.categoryBitMask = BitMaskType.charactor;
        self.physicsBody?.collisionBitMask = BitMaskType.ground|BitMaskType.wall|BitMaskType.doorWall|BitMaskType.SpecialGround|BitMaskType.board|BitMaskType.damageThing;
        self.physicsBody?.allowsRotation = false;
        self.physicsBody?.restitution = 0;
    }
}
